<template>
    <section class="integral-product-box">
      <ul>
        <li
          v-for="(item, index) in productArr"
          @click="toProductDetail(item)"
          :key="index">
          <img :class="item.path ? '' : 'inline-block'" :src="item.path" alt="">
          <div class="centent inline-block">
            <p class="color45454D fs14 clamp1 product-name">
              {{item.name}}
            </p>
            <p class="fs14 colorF54E4E">
              {{item.point}}<span>积分</span>

            </p>
            <p class="progress color7A7B82">
              <span class="box pr inline-block">
                <span class="progress-content pa" :style="{width:item.surpluspercentage + 'px'}"></span>
              </span>
              仅剩{{item.surplus}}件
            </p>
            <p class="mt10">
              <span class="btn text-c fll" @click.stop="handleConversion(item)">立即兑换</span>
            </p>
          </div>
        </li>
        <!--<li></li>-->
      </ul>
    </section>
</template>

<script type="text/ecmascript-6">
  export default {
    data() {
      return {

      }
    },
    props:['productArr'],
    methods: {
      toProductDetail(item){
        this.$emit('product-detail',item)
      },
      handleConversion(item){
        this.$emit('conversion-id',item)
      },
    },
  }
</script>

<style scoped lang="scss">
 @import '../assets/css/base.scss';

  .integral-product-box{
    width: 100%;
    padding-top: 10px;

    ul{
      width: 100%;
      height:auto;

      li{
        /*width: calc(100% / 2 - 6px);*/
        width: 100%;
        height:120px;
        margin-bottom: 20px;

        img {
          background: #EEE;
          width: 120px;
          height: 100%;
          vertical-align: top;
        }

        .centent{
          width: calc(100% - 128px);
          height:100%;
          padding:10px 0;
          box-sizing: border-box;

          p{
            margin-top: 5px;
          }

          p.product-name{
            font-weight: 600;
            margin-top: 0 !important;
          }

          p.progress {
            font-size: 11px;

            .box{
              top:-2px;
              left: 0;
              background: #eee;
              width: 64%;
              height:3px;
              border-radius: 6px;
              margin-right: 4px;


              .progress-content{
                background: -webkit-linear-gradient(left, #FF966B, #FD6252);
                height:100%;
                border-radius: 6px;
              }
            }
          }

          p:last-child{
            color: #F87676;
            height: 26px;
            line-height: 26px;
            margin-top: 4px;

            span.btn{
              background: -webkit-linear-gradient(left, #FF966B, #FD6252);
              font-size: 11px;
              width: 80px;
              height: 28px;
              line-height: 28px;
              color: #fff;
              border-radius: 14px;
            }
          }
        }
      }
    }
  }

  @media screen and(max-width: 320px){
    .centent{
      .box{
        width: 62% !important;
      }
    }
  }
</style>
